package com.genokon.druid.multiple;

/**
 *
 * @author by baichaoda
 * @date 2020/7/30 18:19
 */
public class DataSourceContextHolder {
    private static final ThreadLocal<String> contextHolder = new InheritableThreadLocal<>();

    /**
     *
     * @param db d
     */
    public static void setDataSource(String db){
        contextHolder.set(db);
    }

    /**
     *
     * @return db
     */
    public static String getDataSource(){
        return contextHolder.get();
    }

    /**
     *
     */
    public static void clear(){
        contextHolder.remove();
    }
}
